package com.kangyi.admin.controller;

import com.kangyi.admin.service.OrganizationService;
import com.kangyi.result.Result;
import com.kangyi.vo.OrganizationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@RestController
@RequestMapping("/admin/organization")
@Slf4j
@Api(tags = "机构相关接口")
public class OrganizationController {

    @Autowired
    private OrganizationService organizationService;

    @GetMapping("/inquiry")
    @ApiOperation("查询机构")
//    @Cacheable(cacheNames = "organization_",key = "'adminInquiry_'")
    public Result<List<OrganizationVO>> inquiryOrganization(){
        log.info("查询机构");
        try {
            List<OrganizationVO> organizationVOList = organizationService.inquiryOrganization();
            return Result.success(organizationVOList,"查询成功！");
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }
}
